﻿using UnityEngine;
using System.Collections;

public class LevelTimer : GameLogic {

	public float levelTime;
	float subtractAmount;
	// Use this for initialization
	void Start () {
		Camera.main.aspect = 16.0f / 9.0f;
		Vector3 p = Camera.main.ViewportToWorldPoint(new Vector3 (0, 0.95f, 0));
		p.z = transform.position.z;
		this.transform.position = p;
		subtractAmount = (this.transform.localScale.x / levelTime) / 60.0f;

	}
	//5 seconds take 1/5 off of transform
	// Update is called once per frame
	void Update () {

		this.transform.localScale = new Vector3(this.transform.localScale.x - subtractAmount, this.transform.localScale.y,this.transform.localScale.z);

		if (transform.localScale.x < 0.1f)
						TimerRanOut ();
	}
}
